package api

type Res struct {
	Code int         `json:"code"`
	Des  string      `json:"des"`
	Data interface{} `json:"data"`
}

const (
	Success = iota
	Error
)

func Suc(data interface{}) *Res {
	return &Res{
		Code: Success,
		Data: data,
		Des:  "success",
	}

}

func Custom(code int, data interface{}, des string) *Res {
	return &Res{
		Code: code,
		Data: data,
		Des:  des,
	}

}

func Err() *Res {
	return &Res{
		Code: Error,
		Data: nil,
		Des:  "error",
	}
}
